<!-- 出库下架单 -->
<template>
  <div class="Scheduling_table">
    <el-table :data="tableData" :header-cell-style="{padding:0,margin:0}">
      <template v-for="(item,index) in tableLabel">
        <el-table-column :key="index" align="center" v-if="!item.label" :width="item.width">
          <template slot="header">
            <div>{{item.day}}</div>
            <div>{{item.week}}</div>
          </template>
          <template slot-scope="scope">
            <div
              @click="newdata(scope.row[item.key])"
              class="status01"
              :style="scope.row[item.key] | filter"
            >{{scope.row[item.key]&&scope.row[item.key].weeks?scope.row[item.key].weeks:''}}</div>
          </template>
        </el-table-column>
        <el-table-column :key="index" v-else align="center" :width="item.width">
          <template slot="header">
            <div>{{item.label}}</div>
          </template>
          <template slot-scope="scope">
            <div class="status01">{{scope.row[item.param]}}</div>
          </template>
        </el-table-column>
      </template>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "",
  filters:{
    filter:(value)=>{
      if (value&&value.status&&value.status==0) {
        return 'background: #FFFFFF'
      }
      if (value&&value.status&&value.status==2) {
        return 'background: #ccc;color:#FFF'
      }
      if (value&&value.status&&value.status==1) {
        return 'background: #009900;color:#FFF'
      }
      if (value&&value.status&&value.status==3) {
        return 'background: #199ED8;color:#FFF'
      }
      if (value&&value.status&&value.status==4) {
        return 'background: #33FF00;color:#FFF'
      }
      // scope.row[item.key]&&scope.row[item.key].status==0?'background: #FFFFFF':scope.row[item.key]&&scope.row[item.key].status==2?'background: #ccc;color:#FFF':scope.row[item.key]&&scope.row[item.key].status==3?'background: #199ED8;color:#FFF':'background: #009900;color:#FFF'
    }
  },
  props: {
    tableData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    tableLabel: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  data() {
    return {
      datas: [],
      tabledatas: []
    };
  },
  components: {},
  methods: {
    getdata(data) {
      return data.weeks;
      console.log(data);
    },
    newdata(val) {
      // console.log(val);
      this.$emit('newdata',val)
    },
  },
  created() {},
  mounted() {}
};
</script>
<style scoped>
/* @import url(); 引入css类 */
.status01 {
  /* color: white; */
  width: 100%;
  height: 40px;
  text-align: center;
  line-height: 40px;
  margin: 0;
  padding: 0;
  cursor: default;
}
.Scheduling {
  padding: 20px;
}
</style>